<?php
/*
	We get the following values by default from EditInPlace:

	id - The DOM id
	form_type - The edit field type (text, textarea, select)
	old_content - The pre-edited content
	new_content - The edited content

	If the form_type was select then we'll also get
	old_option - The pre-edited option
	new_option - The edited option
	old_option_text - The pre-edited display option
	new_option_text - The edited display option

	If any additional data was specified via the xhr_data option
	then it will also be provided.
 */

// Add a little delay so that the user has a chance
// to actually see the saving message.
sleep(3);

#this is the div id for each specific html element
$id					= $_POST["id"];
$form_element = $_POST[$id]; 
//echo $id;
echo $form_element;
$form_type		= $_POST["form_type"];

$old_content		= rawurldecode($_POST["old_content"]);

//this new content needs to be sent to the database for an update
$new_content		= rawurldecode($_POST["new_content"]);


if($form_type == "select") {
	$old_option			= $_POST["old_option"];
	$new_option			= $_POST["new_option"];
	$old_option_text		= $_POST["old_option_text"];
	$new_option_text		= $_POST["new_option_text"];
}


//print_r("<pre>\n" . print_r($_POST, true) . "\n</pre>\n");
print(rawurldecode($new_content));
?>
